package org.simp.context;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.simp.common.Constants;
import org.simp.node.SimpNode;

/**
 * @author zhuhaitao at 2014-5-23
 *
 * 
 */
public class SimpContextWraper implements SimpContext{

	private Map<String,Object> attributes = Collections.synchronizedMap(new HashMap<String,Object>());
	
	private SimpNode node;
	@Override
	public String getContextName() {
		return (String) attributes.get(Constants.NODE_NAME);
	}

	@Override
	public void addAttribute(String key, Object value) {
		attributes.put(key, value);
		
	}

	@Override
	public Object getAttribute(String key) {
		return attributes.get(key);
	}

	@Override
	public String getContextType() {
		// TODO Auto-generated method stub
		return (String) attributes.get(Constants.NODE_TYPE);
	}

	@Override
	public void setSimpNode(SimpNode node) {
		this.node = node;
		
	}

	@Override
	public SimpNode getSimpNode() {
		// TODO Auto-generated method stub
		return node;
	}

}
